package adapters;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.example.administrator.newxlmedical.R;

import java.util.List;

/**
 * Created by Administrator on 2018/9/28.
 */

public class VersionAdapter extends BaseAdapter {
    private List<String> list;
    private Context mContext;

    public VersionAdapter(Context context, List<String> list) {
        this.list = list;
        mContext = context;
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int position) {
        return list.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        View inflate = LayoutInflater.from(mContext).inflate(R.layout.adapter_version, null);
        String apk = list.get(position);
        TextView tv_apk = (TextView) inflate.findViewById(R.id.tv_adapter_apk);
        tv_apk.setText(apk);

        return inflate;
    }
}
